package cn.tedu.esspringboot.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(indexName = "students",shards = 3,replicas = 2)
public class Student {

    @Id
    private Long id;
    @Field(type = FieldType.Text,analyzer = "ngram")
    private String name;
    @Field(type = FieldType.Keyword)
    private Character gender;
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-M-d")
    private String birthDate;
}
